<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  
  <title>图片压缩方案 | 一枚前端小菜鸟的博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="场景 上传图片压缩 图片大小在 500K 内，且对清晰度有要求  方案说明将上传的图片压缩到 500K 内，尽可能的保证画质，但很难保证所有图片均不会模糊。前端可以采用 canvas 进行图片压缩，保证图片大小符合要求，且画质尚可，基于 本地图片压缩@育仪 的方式做部分修改后得到两种方案。主体都是针对 quality 进行递减，直到压缩后的图片符合要求的 maxSize 为止。  不修改原图片宽高">
<meta property="og:type" content="article">
<meta property="og:title" content="图片压缩方案">
<meta property="og:url" content="https://gitee.com/weiyayun1995/weiyayun1995.git/2021/04/13/%E6%9C%AC%E5%9C%B0%E5%9B%BE%E7%89%87%E5%8E%8B%E7%BC%A9%EF%BC%88%E6%96%B9%E6%A1%88%E4%BA%8C%EF%BC%89/index.html">
<meta property="og:site_name" content="一枚前端小菜鸟的博客">
<meta property="og:description" content="场景 上传图片压缩 图片大小在 500K 内，且对清晰度有要求  方案说明将上传的图片压缩到 500K 内，尽可能的保证画质，但很难保证所有图片均不会模糊。前端可以采用 canvas 进行图片压缩，保证图片大小符合要求，且画质尚可，基于 本地图片压缩@育仪 的方式做部分修改后得到两种方案。主体都是针对 quality 进行递减，直到压缩后的图片符合要求的 maxSize 为止。  不修改原图片宽高">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-04-13T03:08:38.000Z">
<meta property="article:modified_time" content="2021-04-13T03:09:21.483Z">
<meta property="article:author" content="yywei">
<meta property="article:tag" content="菜鸟,前端,js,react,vue">
<meta name="twitter:card" content="summary">
  
    <link rel="alternate" href="/atom.xml" title="一枚前端小菜鸟的博客" type="application/atom+xml">
  
  
    <link rel="shortcut icon" href="/favicon.png">
  
  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typeface-source-code-pro@0.0.71/index.min.css">

  
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css">

  
<meta name="generator" content="Hexo 5.4.0"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">一枚前端小菜鸟的博客</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">yywei的遇坑记录</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS 订阅"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="搜索"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://gitee.com/weiyayun1995/weiyayun1995.git"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main"><article id="post-本地图片压缩（方案二）" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
  <div class="article-meta">
    <a href="/2021/04/13/%E6%9C%AC%E5%9C%B0%E5%9B%BE%E7%89%87%E5%8E%8B%E7%BC%A9%EF%BC%88%E6%96%B9%E6%A1%88%E4%BA%8C%EF%BC%89/" class="article-date">
  <time class="dt-published" datetime="2021-04-13T03:08:38.000Z" itemprop="datePublished">2021-04-13</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="p-name article-title" itemprop="headline name">
      图片压缩方案
    </h1>
  

      </header>
    
    <div class="e-content article-entry" itemprop="articleBody">
      
        <h2 id="场景"><a href="#场景" class="headerlink" title="场景"></a>场景</h2><ul>
<li>上传图片压缩</li>
<li>图片大小在 <code>500K</code> 内，且对清晰度有要求</li>
</ul>
<h2 id="方案说明"><a href="#方案说明" class="headerlink" title="方案说明"></a>方案说明</h2><p>将上传的图片压缩到 <code>500K</code> 内，尽可能的保证画质，但很难保证所有图片均不会模糊。前端可以采用 <code>canvas</code> 进行图片压缩，保证图片大小符合要求，且画质尚可，基于 <a target="_blank" rel="noopener" href="https://fe.che300.com/easymock/wikiCatalog/5e60c89ebeb7177e5515e423">本地图片压缩@育仪</a> 的方式做部分修改后得到两种方案。主体都是针对 <code>quality</code> 进行递减，直到压缩后的图片符合要求的 <code>maxSize</code> 为止。</p>
<ol>
<li>不修改原图片宽高，仅修改图片质量：采用逐步减小 <code>quality</code>，直到大小符合要求为止，实测压缩后图片清晰，但是缺点一个较大的图片压缩的次数过多，等待时间较长。</li>
<li>修改图片原始最大宽高，同时修改图片 <code>quality</code>，逐步递减直到大小符合条件，但是清晰度尚可，会有少数特殊图片稍微模糊。</li>
</ol>
<h3 id="循环压缩"><a href="#循环压缩" class="headerlink" title="循环压缩"></a>循环压缩</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@returns <span class="type">&#123;file&#125;</span> </span>压缩后的文件对象</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;*&#125;</span> </span>file 文件对象</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;*&#125;</span> </span>maxSize 图片大小限制</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">async</span> <span class="function"><span class="keyword">function</span> <span class="title">whileResize</span>(<span class="params">file, maxSize</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">let</span> quality = <span class="number">0.98</span>;</span><br><span class="line">    <span class="keyword">let</span> resizeFile = file;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 修改图片 quality 直到符合位置</span></span><br><span class="line">    <span class="keyword">while</span> (resizeFile.size &gt; maxSize &amp;&amp; quality &gt; <span class="number">0</span>) &#123;</span><br><span class="line">        <span class="comment">// 保存压缩后的文件对象</span></span><br><span class="line">        resizeFile = <span class="keyword">await</span> resizeImage(&#123;file, quality&#125;);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 判断目前差值，quality 递减值(为了避免单次减太多图片模糊)</span></span><br><span class="line">        <span class="keyword">if</span> (resizeFile.size - maxSize &gt; <span class="number">300000</span>) &#123;</span><br><span class="line">            quality = (quality - <span class="number">0.1</span>).toFixed(<span class="number">2</span>);</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            quality = (quality - <span class="number">0.05</span>).toFixed(<span class="number">2</span>);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    <span class="keyword">return</span> resizeFile;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="使用说明"><a href="#使用说明" class="headerlink" title="使用说明"></a>使用说明</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 若压缩的时间较长，可做 loading 标识</span></span><br><span class="line"><span class="built_in">this</span>.loading = <span class="literal">true</span>;</span><br><span class="line"><span class="keyword">const</span> resizeFile = <span class="keyword">await</span> whileResize(file, maxSize);</span><br><span class="line"><span class="built_in">this</span>.loading = <span class="literal">false</span>;</span><br></pre></td></tr></table></figure>

<h3 id="参数说明"><a href="#参数说明" class="headerlink" title="参数说明"></a>参数说明</h3><table>
<thead>
<tr>
<th align="center">参数</th>
<th align="center">类型</th>
<th>说明</th>
<th>默认值</th>
</tr>
</thead>
<tbody><tr>
<td align="center">file</td>
<td align="center">Object</td>
<td>文件对象</td>
<td>–</td>
</tr>
<tr>
<td align="center">quality</td>
<td align="center">Number</td>
<td>图片质量</td>
<td>0.92</td>
</tr>
<tr>
<td align="center">limitSize</td>
<td align="center">Object</td>
<td>图片尺寸显示</td>
<td><code>undefied</code> 默认不修改图片尺寸，可传参数 <code>&#123; width: 1600, height 1600 &#125;</code></td>
</tr>
<tr>
<td align="center">type</td>
<td align="center">String</td>
<td>图片类型</td>
<td><code>image/jpeg</code></td>
</tr>
</tbody></table>
<h3 id="压缩代码展示"><a href="#压缩代码展示" class="headerlink" title="压缩代码展示"></a>压缩代码展示</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@return </span>Promise 压缩图片</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;Object&#125;</span> </span>file 文件对象</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param <span class="type">&#123;String&#125;</span> </span>type 图片类型 默认：image/jpeg、image/png...</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">export</span> <span class="function"><span class="keyword">function</span> <span class="title">resizeImage</span>(<span class="params">params</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">let</span> &#123;</span><br><span class="line">        file,</span><br><span class="line">        quality,</span><br><span class="line">        limitSize,</span><br><span class="line">        type = <span class="string">&#x27;image/jpeg&#x27;</span></span><br><span class="line">    &#125; = params;</span><br><span class="line">    <span class="comment">// 图片质量，数字类型</span></span><br><span class="line">    quality = quality ? <span class="built_in">Number</span>(quality) : <span class="number">0.98</span>;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function"><span class="params">resolve</span> =&gt;</span> &#123;</span><br><span class="line">        <span class="keyword">let</span> reader = <span class="keyword">new</span> FileReader();</span><br><span class="line">        <span class="keyword">let</span> image = <span class="keyword">new</span> Image();</span><br><span class="line"></span><br><span class="line">        reader.readAsDataURL(file);</span><br><span class="line">        <span class="comment">// 文件 base64 化，以便获知图片原始尺寸</span></span><br><span class="line">        reader.onload = <span class="function"><span class="keyword">function</span>(<span class="params">e</span>) </span>&#123;</span><br><span class="line">            image.src = e.target.result;</span><br><span class="line">        &#125;;</span><br><span class="line">        <span class="comment">// base64地址图片加载完毕后执行</span></span><br><span class="line">        image.onload = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">            <span class="comment">// 缩放图片需要的canvas</span></span><br><span class="line">            <span class="keyword">let</span> canvas = <span class="built_in">document</span>.createElement(<span class="string">&#x27;canvas&#x27;</span>);</span><br><span class="line">            <span class="keyword">let</span> context = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>);</span><br><span class="line">            <span class="comment">// 图片目标尺寸</span></span><br><span class="line">            <span class="keyword">let</span> targetWidth = image.width,</span><br><span class="line">                targetHeight = image.height;</span><br><span class="line">            </span><br><span class="line">            <span class="comment">// 判断是否修改图片尺寸的最大限制</span></span><br><span class="line">            <span class="keyword">if</span> (limitSize) &#123;</span><br><span class="line">                <span class="comment">// 图片原始尺寸</span></span><br><span class="line">                <span class="keyword">let</span> originWidth = image.width,</span><br><span class="line">                    originHeight = image.height;</span><br><span class="line">                <span class="comment">// 最大尺寸限制，可通过设置宽高来实现图片压缩程度</span></span><br><span class="line">                <span class="keyword">let</span> maxWidth = limitSize.width || <span class="number">1600</span>,</span><br><span class="line">                    maxHeight = limitSize.height || <span class="number">1600</span>;</span><br><span class="line"></span><br><span class="line">                <span class="comment">// 图片尺寸超过 1600*1600 的限制</span></span><br><span class="line">                <span class="keyword">if</span> (originWidth &gt; maxWidth || originHeight &gt; maxHeight) &#123;</span><br><span class="line">                    <span class="keyword">if</span> (originWidth / originHeight &gt; maxWidth / maxHeight) &#123;</span><br><span class="line">                        <span class="comment">// 更宽，按照宽度限定尺寸</span></span><br><span class="line">                        targetWidth = maxWidth;</span><br><span class="line">                        targetHeight = <span class="built_in">Math</span>.round(maxWidth * (originHeight / originWidth));</span><br><span class="line">                    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                        <span class="comment">// 更高，按照高度限定尺寸</span></span><br><span class="line">                        targetHeight = maxHeight;</span><br><span class="line">                        targetWidth = <span class="built_in">Math</span>.round(maxHeight * (originWidth / originHeight));</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            </span><br><span class="line">            <span class="comment">// canvas对图片进行缩放</span></span><br><span class="line">            canvas.width = targetWidth;</span><br><span class="line">            canvas.height = targetHeight;</span><br><span class="line">            <span class="comment">// 清除画布</span></span><br><span class="line">            context.clearRect(<span class="number">0</span>, <span class="number">0</span>, targetWidth, targetHeight);</span><br><span class="line">            <span class="comment">// 绘制图片</span></span><br><span class="line">            context.drawImage(image, <span class="number">0</span>, <span class="number">0</span>, targetWidth, targetHeight);</span><br><span class="line">            <span class="comment">// 异步方法 Bolb对象</span></span><br><span class="line">            canvas.toBlob(</span><br><span class="line">                blob =&gt; &#123;</span><br><span class="line">                    <span class="comment">// 重新转为 正常的 File 对象 让 antd Upload 接收</span></span><br><span class="line">                    <span class="keyword">let</span> newFile = <span class="keyword">new</span> File([blob], file.name, &#123;<span class="attr">type</span>: file.type&#125;);</span><br><span class="line">                    newFile.uid = file.uid;</span><br><span class="line">                    resolve(newFile);</span><br><span class="line">                &#125;,</span><br><span class="line">                type, <span class="comment">// 图片类型</span></span><br><span class="line">                quality <span class="comment">// 图片质量</span></span><br><span class="line">            );</span><br><span class="line">        &#125;;</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="注意事项"><a href="#注意事项" class="headerlink" title="注意事项"></a>注意事项</h2><ul>
<li>实测 <code>image/png</code> 、 <code>image/jpg</code> 比 <code>image/jpeg</code> 压缩后生成的图片要大一些，选择 <code>type = &#39;image/jpeg&#39;</code></li>
<li>以上两个方案的唯一区别：二比一仅增加了图片最大宽高的限制</li>
</ul>
<h2 id="第三方插件"><a href="#第三方插件" class="headerlink" title="第三方插件"></a>第三方插件</h2><p>若不想自己写压缩的代码，也可以引入第三方库 <a target="_blank" rel="noopener" href="https://github.com/fengyuanchen/compressorjs/blob/master/src/index.js">compressorjs</a>，可传入参数进行压缩，也是使用 <code>canvas</code> 的方式进行的压缩，其内部解决了图片自动旋转(<code>EXIF Orientation</code>)的问题，调用该方法只进行一次压缩，通过回调函数的方式返回压缩后的文件对象。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Compressor <span class="keyword">from</span> <span class="string">&#x27;compressorjs&#x27;</span>;</span><br><span class="line"><span class="keyword">new</span> Compressor(file, &#123;</span><br><span class="line">    quality: <span class="number">0.6</span>,</span><br><span class="line">    <span class="function"><span class="title">success</span>(<span class="params">result</span>)</span> &#123;</span><br><span class="line">        <span class="keyword">const</span> formData = <span class="keyword">new</span> FormData();</span><br><span class="line"></span><br><span class="line">        <span class="comment">// The third parameter is required for server</span></span><br><span class="line">        formData.append(<span class="string">&#x27;file&#x27;</span>, result, result.name);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// Send the compressed image file to server with XMLHttpRequest.</span></span><br><span class="line">        axios.post(<span class="string">&#x27;/path/to/upload&#x27;</span>, formData).then(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">&#x27;Upload success&#x27;</span>);</span><br><span class="line">        &#125;);</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="function"><span class="title">error</span>(<span class="params">err</span>)</span> &#123;</span><br><span class="line">        <span class="built_in">console</span>.log(err.message);</span><br><span class="line">    &#125;,</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      <a data-url="https://gitee.com/weiyayun1995/weiyayun1995.git/2021/04/13/%E6%9C%AC%E5%9C%B0%E5%9B%BE%E7%89%87%E5%8E%8B%E7%BC%A9%EF%BC%88%E6%96%B9%E6%A1%88%E4%BA%8C%EF%BC%89/" data-id="ckq7mlsvn000mdgt9ekmfb8q8" data-title="图片压缩方案" class="article-share-link">分享</a>
      
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2021/04/13/%E6%9C%AC%E5%9C%B0%E5%9B%BE%E7%89%87%E5%8E%8B%E7%BC%A9%EF%BC%88%E6%96%B9%E6%A1%88%E4%B8%80%EF%BC%89/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">前一篇</strong>
      <div class="article-nav-title">
        
          本地图片压缩（方案一）
        
      </div>
    </a>
  
  
    <a href="/2021/04/13/%E5%9C%A8for%E5%BE%AA%E7%8E%AF%E4%B8%AD%E8%B0%83%E7%94%A8%E5%BC%82%E6%AD%A5%E6%8E%A5%E5%8F%A3-%E6%89%A7%E8%A1%8C%E5%BC%82%E6%AD%A5%E4%BB%A3%E7%A0%81%E5%9D%97/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">后一篇</strong>
      <div class="article-nav-title">在for循环中调用异步接口/执行异步代码块</div>
    </a>
  
</nav>

  
</article>


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/06/">六月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/05/">五月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/04/">四月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/03/">三月 2021</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2021/06/22/js%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E5%8F%8A%E8%BD%AC%E6%8D%A2/">js数据类型及转换</a>
          </li>
        
          <li>
            <a href="/2021/06/18/react-hook-%E9%A1%B9%E7%9B%AE%E4%B8%AD%E5%AE%9E%E8%B7%B5/">react-hook 项目中实践</a>
          </li>
        
          <li>
            <a href="/2021/06/18/%E6%95%B0%E5%AD%97%E7%AD%BE%E5%90%8D/">数字签名</a>
          </li>
        
          <li>
            <a href="/2021/06/18/sendbeacon/">sendbeacon</a>
          </li>
        
          <li>
            <a href="/2021/06/18/js%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%88%A4%E6%96%AD/">js数据类型的判断</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      
      &copy; 2021 yywei<br>
      Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="/js/jquery-3.4.1.min.js"></script>



  
<script src="/fancybox/jquery.fancybox.min.js"></script>




<script src="/js/script.js"></script>





  </div>
</body>
</html>